import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/index',
    component: HomeView,

    children: [
      {
        path: '/reservation',
        component: () => import('../views/ReservationView')
      },
      {
        path: '/userDetail',
        component: () => import('../views/UserDetail.vue')
      },
      {
        path: '/index',
        component: () => import('../views/IndexView')
      },
      {
        path: '/lease-house',
        component: () => import('../views/LeaseHouseView')
      },
      {
        path: '/new-house',
        component: () => import('../views/NewHouseView')
      },
      {
        path: '/second-hand-house',
        component: () => import('../views/SecondHandHouseView')
      },
      {
        path: '/lease-house-detail',
        component: () => import('../views/LeaseHouseDetailsView')
      },
      {
        path: '/new-house-detail',
        component: () => import('../views/NewHouseDetailsView')
      },
      {
        path: '/second-hand-house-detail',
        component: () => import('../views/SecondHandHouseDetailsView')
      },
      {
        path: '/newsDetail',
        component: () => import('../views/NewsDetail')
      },
      {
        path: '/news-list',
        component: () => import('../views/NewsList')
      },
      {
        path: '/user-news-list',
        component: () => import('../views/UserNewsList')
      },
      {
        path: '/user-collection-house',
        component: () => import('../views/UserCollectionHouseView')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('../views/LoginView')
  },
  {
    path: '/reg',
    component: () => import('../views/RegView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
})

export default router
